Make sum of two integers with extra conditionΒΆ
Sum of two given integers.
However, if the sum is between 15 to 20 it will return 20.
def sum(x, y):
sum = x + y
if sum in range(15, 20):
return 20
else:
return sum
# test
print(sum(10, 6)) # 20
print(sum(10, 2)) # 12
print(sum(10, 12)) # 22